package com.wanho.java156.mapper;

import com.wanho.java156.po.Role;
import com.wanho.java156.po.RoleExample;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface RoleMapper {
    /**
     * 根据 用户id 查询该用户对应的角色集合
     * @param userid
     * @return
     */
    List<Role> selectRoleByUserId(String userid);

    /**
     * 查询所有角色及权限
     * @return
     */
    List<Role> selectAllRoleAndPerm();
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Thu Apr 08 19:43:09 CST 2021
     */
    int deleteByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Thu Apr 08 19:43:09 CST 2021
     */
    int insert(Role record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Thu Apr 08 19:43:09 CST 2021
     */
    int insertSelective(Role record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Thu Apr 08 19:43:09 CST 2021
     */
    List<Role> selectByExample(RoleExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Thu Apr 08 19:43:09 CST 2021
     */
    Role selectByPrimaryKey(String id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Thu Apr 08 19:43:09 CST 2021
     */
    int updateByPrimaryKeySelective(Role record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table role
     *
     * @mbg.generated Thu Apr 08 19:43:09 CST 2021
     */
    int updateByPrimaryKey(Role record);

    int insertUserRole(@Param("userId") String userId, @Param("newRoleId") List<String> newRoleId);

    int deleteUserRole(@Param("userId") String userId, @Param("oldRoleId") List<String> oldRoleId);
}